package com.gymmsystem.GYMMSystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gymmsystem.GYMMSystem.entity.MemberCardType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
 * 会员卡类型Mapper接口
 */
@Mapper
public interface MemberCardTypeMapper extends BaseMapper<MemberCardType> {

    /**
     * 更新会员卡价格和状态
     */
    @Update("UPDATE member_card_types SET price = #{price}, status = #{status}, update_time = NOW() WHERE card_type_id = #{cardTypeId}")
    int updatePriceAndStatus(@Param("cardTypeId") Long cardTypeId,
                             @Param("price") BigDecimal price,
                             @Param("status") Integer status);

    /**
     * 根据卡名称查询
     */
    MemberCardType findByCardName(String cardName);
}